<!--订阅弹窗-->
<?php
/**
 * @var \Mslynn\Live\Block\LiveBlock $block
 */

if ($block->getEnable()){
    ?>


<?php if ($block->getliveenable()){ ?>
     <a href="/live" >
    <div class="live-player" id="J_prismPlayer"></div>
     </a>
        <script>
        require(['hls'],function(hls){
            window.Hls=hls
            console.log(hls)
            require(['aliplayer'],function (aliplayer){
                var player = new Aliplayer({
                    id: 'J_prismPlayer',
                    width: '300px',
                    height:'300px',
                    autoplay: true,
                    language: "en-us",
                    //支持播放地址播放,此播放优先级最高
                    source : '<?php  echo $block->getLiveUrl();?>',
                    isLive:true,
                },function(player){
                    console.log('播放器创建好了。')
                    player.mute();
                    player.play();

                })
                console.log(player)
            })
        })
    </script>
<?php }else{ ?>

        <div class="floating" style="display: block;">
            <div class="close" onclick="close_x()">

                <img src='<?php echo $this->getViewFileUrl("images/cancel_round.png"); ?>' >
            </div>
            <a href="https://www.alipearlhair.com/live/index.php">
                <img src="<?php echo $block->getBackgroud()?>">
            </a>
        </div>
        <script>
            function close_x () {
                var flat=document.querySelector(".floating")
                flat.style.display='none'
            }
        </script>

    <?php }?>

<?php }?>


